<form class="layui-form" method="post">
    <div class="layui-form-item" style="padding-top: 2%">
        <label class="layui-form-label">任务开启时间：</label>
        <div class="layui-input-inline">
            <input class="layui-input" placeholder="建议提前两分钟" name="tasktime" lay-verify="required" onclick="layui.laydate({elem: this, istime: true, format: 'YYYY-MM-DD hh:mm:ss'})">
        </div>
    </div>
    <div class="layui-form-item">
        <div class="layui-input-block">
            <button class="layui-btn" lay-submit lay-filter="sitesub">提交</button>
        </div>
    </div>
</form>
<script>
    form.render();
    form.on('submit(sitesub)', function(data){
        var userInfo = data.field;
        var url = "__SELF__";
        $.post(url,userInfo,function(data){
            if(data.code == '4001'){
                layer.msg(data.msg,{icon: 5});
                return;
            }else if(data.code == '101'){
                layer.msg(data.msg, {
                    icon: 6,
                    time: 2000
                }, function(){
                    location.reload();
                });
            }else{
                layer.msg("数据错误",{icon: 5});
                return;
            }
        });

        return false;
    });

</script>